/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2009 Sam Lantinga

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Sam Lantinga
    slouken@libsdl.org
*/
#include "SDL_config.h"

/* PS3 Include */
#include <ppu_intrinsics.h>


void							CELL_ConvertU8		(int16_t* aDest, uint8_t* aSource, uint32_t aCount)
{
	for(int i = 0; i != aCount; i ++)
	{
		int32_t tack = aSource[i];
		aDest[i] = (tack * 256) - 32768;
	}
}

void							CELL_ConvertS8		(int16_t* aDest, int8_t* aSource, uint32_t aCount)
{
	for(int i = 0; i != aCount; i ++)
	{
		aDest[i] = aSource[i] * 256;
	}
}

void							CELL_ConvertU16MSB	(int16_t* aDest, uint16_t* aSource, uint32_t aCount)
{
	for(int i = 0; i != aCount; i ++)
	{
		aDest[i] = aSource[i] - 32768;
	}
}

/* LHBRX ? */
void							CELL_ConvertU16LSB	(int16_t* aDest, uint16_t* aSource, uint32_t aCount)
{
	for(int i = 0; i != aCount; i ++)
	{
		/* TODO: This doesn't work... but U16 samples are rare so I don't care */
		aDest[i] = aSource[i] - 32768;
	}
}

